﻿// Original author contact info: Owen Emlen (owene_1998@yahoo.com)
// Note: other individuals may also have contributed to this code
// Project hosted on CodePlex.com as of 1/10/2009 at http://www.codeplex.com/EmlenMud
using System;
using System.Runtime.Serialization;
using BrainTechLLC.ThreadSafeObjects;

namespace BrainTechLLC
{
    [Serializable]
    [DataContract]
    public class GenericAttributeBool : Attribute, IReadableAttribute
    {
        public GenericAttributeBool() { }
        [DataMember]
        public bool Val { get; set; }
        public GenericAttributeBool(bool startVal) { Val = startVal; }
        public object Value { get { return Val; } }
    }

    [Serializable]
    [DataContract]
    [AttributeUsage(AttributeTargets.Method)]
    public class MethodVisible : GenericAttributeBool, IReadableAttribute
    {
        public MethodVisible() : base(true) { }
    }

    [Serializable]
    [DataContract]
    public class GenericAttributeString : Attribute, IReadableAttribute
    {
        public GenericAttributeString() { }

        [DataMember]
        public string Val { get; set; }
        public GenericAttributeString(string startVal) { Val = startVal; }
        public object Value { get { return Val; } }
    }

    [Serializable]
    [DataContract]
    [AttributeUsage(AttributeTargets.Class)]
    public class IDProperty : System.Attribute, IReadableAttribute
    {
        protected string _prop;
        public IDProperty(string prop) { _prop = prop; }
        public string IDPropertyName { get { return _prop; } }
        public object Value { get { return _prop; } }
    }

    [AttributeUsage(AttributeTargets.Class)]
    public class KeyOnProperty : System.Attribute
    {
        private string _val;

        public KeyOnProperty(string val)
        {
            _val = val;
        }

        public string PropertyToKeyOn
        {
            get { return _val; }
        }
    }

    [AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
    public class RaisePropertyChangedForThisPropertyWhenOtherPropertyChangesAttribute : GenericAttributeString
    {
        public RaisePropertyChangedForThisPropertyWhenOtherPropertyChangesAttribute(string val)
            : base(val)
        {
        }
    }

    [AttributeUsage(AttributeTargets.Property)]
    public class ReturnValueWhenNullAttribute : GenericAttributeString
    {
        public ReturnValueWhenNullAttribute(string val)
            : base(val)
        {
        }
    }
}
